#include <windows.h>
#include <iostream>
using namespace std;

#include "character.h"
#include "combat.h"
#include "dice.h"

void disable_input_buffering()
{
	HANDLE console = GetStdHandle(STD_INPUT_HANDLE);
	DWORD mode;
	GetConsoleMode(console, &mode);
	SetConsoleMode(console, mode & ~ENABLE_LINE_INPUT);
	cin >> noskipws;
}

char get_keypress()
{
	char answer;
	cin >> answer; // wait for keypress to end
	return answer;
}

int main() 
{
	disable_input_buffering();

	stats player_stats = { 20, 5, 6, 5, 17, 18, 19, 20 };
	stats dragon_stats = { 20, 5, 6, 5, 17, 18, 19, 20 };
	stats bagley_stats = { 20, 5, 6, 5, 17, 18, 19, 20 };

	character player("player", &player_stats);
	character dragon("dragon", &dragon_stats);
	character bagley("Bagley Man", &bagley_stats);

	combat director(&player, &dragon, &bagley);

	random roller(&director);
	roller.start();

	cout << "Fight!" << endl;

	director.fight();

	get_keypress();

	return 0;
}
